package com.knight.hadoop.day04.mythread.thread.pool;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class ThreadPoolWithCallable {
	public static void main(String[] args) throws Exception {
		ExecutorService pool = Executors.newFixedThreadPool(4);
		
		for(int i=0;i<10;i++){
			Future<String> submit = pool.submit(new Callable<String>(){

				@Override
				public String call() throws Exception {
					return "b-"+Thread.currentThread().getName();
				}
			});
			System.out.println(submit.get());
		}
		pool.shutdown();
	}
}
